// 扩展运算符
console.log('========== 扩展运算符 ==========');
let nums = [1, 2, 3, 4, 5, 6];
// 拆分数组
console.log(...nums);
let add = (num1, num2) => num1 + num2;
console.log(add(...[10, 20]));

// 向数组中追加元素
let newNums = [0];
newNums.push(...nums);
console.log(...newNums);

// 解构表达式结合使用
let [n1, ...nn] = nums;
console.log(n1);
console.log(nn);

// 将字符串拆分为数组
let str = 'Hello';
let arrayStr = [...str];
console.log(arrayStr);